/**
 * @author zj
 * @desc:
 * @date: 2024/8/14 14
 */
import { defineStore } from "pinia";

const useUserInfo = defineStore("userInfo", {
  state: () => {
    return {
      // 用户信息
      userInfo: {},
      theme: "light",
    };
  },
  actions: {
    reset() {
      this.$reset();
      sessionStorage.removeItem("userInfo");
    },
    setTheme(theme) {
      this.theme = theme;
    },
    getTheme() {
      return this.theme;
    },
  },
  persist: {
    enabled: true,
    storage: sessionStorage,
  },
});

export default useUserInfo;
